<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CmOutApiAccessLog extends Migrator
{

    public function change()
    {
        $table = $this->table('cm_outapi_access_log', ['auto_increment' => true, 'limit' => 10, 'signed' => false]);
        $table->addColumn('request_url', 'string', ['limit' => 255, 'default' => '请求地址'])
            ->addColumn('request_type', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求类型(http、rpc等)'])
            ->addColumn('data', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求数据'])
            ->addColumn('response_code', 'string', ['limit' => 255, 'default' => '', 'comment' => '路由名称(类名@方法名)'])
            ->addColumn('response_data', 'string', ['limit' => 255, 'default' => '', 'comment' => '请求数据'])
            ->addColumn('request_time', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '请求时间'])
            ->addColumn('create_time', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '记录创建时间'])
            ->create();
    }
}
